﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WcfBackend;

public partial class Userprofile : System.Web.UI.Page
{
    private WcfBackend.WcfFoodAndAllergiesClient wcf;
    private User user;
    protected void Page_Load(object sender, EventArgs e)
    {
        wcf = new WcfFoodAndAllergiesClient();

        try
        {
            user = (User)Session["user"];

            txtNewName.Text = user.UserName;

        }
        catch(NullReferenceException ex)
        {
            Response.Redirect("Default.aspx");
        }

    }


    protected void btnCreate_Click(object sender, EventArgs e)
    {

    }


    protected void cblAllergies_DataBound(object sender, EventArgs e)
    {
        foreach (Allergies a in user.UserAllergies)
        {
            cblAllergies.Items.FindByValue(a.Id + "").Selected = true;
        }

    }
}